/*
 * @Description: 
 * @Author: Haor
 * @Date: 2022-08-27 13:22:08
 * @LastEditTime: 2022-08-28 17:22:47
 * @LastEditors: Haor
 */
import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
import { PublicEntity } from '@entities/public.entity'

@Entity({
    name: 'sys_file',
    orderBy: { createTime: 'ASC' }
})
export class FileEntity extends PublicEntity {
    @Column({ comment: '文件名称' })
    name: string

    @Column({ name: 'origin_name', comment: '文件原始名' })
    originName: string

    @Column({ comment: '文件后缀名' })
    suffix: string

    @Column({ comment: '大小，单位（KB）'})
    size: number

    @Column({ comment: '文件存放路径' })
    path: string

    @Column({ name: 'is_filing', comment: '是否落盘，0.未落盘，1.已落盘' })
    isFiling: number

    @Column({ name: 'sign_hash', comment: '文件签名hash（由创建时间+修改时间+文件大小）组合,并转为MD5' })
    signHash: string
}

/**
 * 业务文件实体
 */
@Entity({
    name: 'sys_file_business'
})
export class FileBusinessEntity {
    @PrimaryColumn()
    id: number

    @Column({ name: 'biz_id', comment: '业务id' })
    bizId: number

    @Column({ name: 'file_id', comment: '文件id' })
    fileId: number

    @Column({ comment: '备注' })
    remark: string
}
